﻿using System.Collections.Generic;

namespace Fetches.Fetch.Fetcher.LinkExtractor
{
    public class QueryExtractorNode
    {
        /// <summary>
        /// CssSelector意味着也可以搞XpathSelector。ExcludeNodes基本只需要Selector就够了
        /// </summary>
        public string CssSelector { get; set; }
        public string AttributeName { get; set; } = "href";
        public bool IsSingle { get; set; }
        /// <summary>
        /// 默认去除空格后再进行后续的转换
        /// </summary>
        public bool Trim { get; set; } = true;
        /// <summary>
        /// 添加前缀，实现AppendPrefix+"HrefValue"这种模式
        /// </summary>
        public string AppendPrefix { get; set; }
        /// <summary>
        /// 添加前缀，实现"http://domain/hrefValue"+AppendSuffix这种模式
        /// </summary>
        public string AppendSuffix { get; set; }
        /// <summary>
        /// 这个规则用于实现字符串替换，效果与顺序有关
        /// </summary>
        public IList<KeyValuePair<string,string>> ReplaceRule=new List<KeyValuePair<string, string>>();
        //实现在链接某个位置插入字符的转换
       // public Index("")/LastIndex("")+HrefValue+InsertStr InsertRule
    }
}
